import Api from 'api';

import bffApi from 'fetch';

class webApi {
    queryDetail = (tid = '') => Api({
        url: `order/detail/${tid}`,
        method: 'GET'
    })


    queryShipCompanys = (params = {})=>Api({
        url: 'order/shipCompany/list',
        method: 'POST',
        body: Object.assign({}, params)
    });



    deliveryOrder = (params = {})=>Api({
        url: 'order/deliveryTrade',
        method: 'POST',
        body: Object.assign({}, params)
    });


    completeOrder = (tid = '')=>Api({
        url: `order/complete/${tid}`,
        method: 'POST',
        body: {}
    })


    cancelOrder = (tid = '')=>Api({
        url: `order/cancel/${tid}`,
        method: 'POST',
        body: {}
    })


    editSellerRemark = (params)=>Api({
        url: 'order/sellerRemark',
        method: 'POST',
        body: Object.assign({}, params)
    })


    getToken = (userId = '')=>Api({
        url: `token/${userId}`,
        method: 'POST',
        body: {}
    })

    modifyBuyerConsignee = (params)=>Api({
        url: 'order/modifyBuyerConsignee',
        method: 'POST',
        body: Object.assign({}, params)
    })


    queryUserReceiptList = ()=>bffApi('/accounts/deliver_address_list', 'GET')


    saveReceipt = (params = {})=>bffApi('/accounts/deliver_address', 'POST', params)

    refundBefore = (tid = '')=>Api({
        url: `order/refund/${tid}`,
        method: 'GET'
    })

    refund = (params = {})=>Api({
        url: 'order/refund',
        method: 'POST',
        body: Object.assign({}, params)
    })

}

export default new webApi();